<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html lang="ru" xml:lang="ru">

<head>
  <meta http-equiv="Content-type" content="text/html; charset=windows-1251" />
  <title>Basis Test Suite</title>

  <style type="text/css">
    @import "style/default/style.css";

    BODY,
    HTML
    {
      padding: 0;
      margin: 0;
      height: 100%;
      overflow: hidden;
      font-family: Verdana, Tahoma, Arial, sans-serif;
      font-size: small;
      _font-size: x-small;
    }
    #Interface
    {
      height: 100%;
    }

    #TestList
    {
      height: 100%;
      float: left;
      width: 380px;
      border-right: 1px solid #888;
      overflow: auto;
      overflow-x: auto;
      overflow-y: scroll;
    }
    #TestList *
    {
      line-height: 1.2em;
    }
    #TestList UL
    {
      margin: 0;
      padding: 0;
      list-style: none;
    }
    #TestList LI
    {
      margin: 0;
      padding: 0;
      clear: both;
      border-top: 1px solid white;
      border-bottom: 1px solid #E0E0E0;
      line-height: 1em;
      background: #F8F8F8;
    }
    #TestList LI LABEL
    {
      display: block;
      cursor: pointer;
      zoom: 1;
    }

    #TestList LI .checker
    {
      float: left;
      padding: .1em .2em 0;
      _padding: .1em 0 0 .2em;
      background-color: white;
    }
    #TestList LI .title
    {
      border-left: 1px solid #D0D0D0;
      margin: 0;
      _width: 225px;
      padding: .25em;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      -o-text-overflow: ellipsis;
    }

    #TestList LI .indicator
    {
      position: relative;
      float: right;
      width: 15.5ex;
      padding: .2em 4px 0 1px;
      height: 1.49em;
      _height: 1.65em;
      border-left: 1px solid #D0D0D0;
      background: white;
      text-align: right;
    }
    #TestList LI .indicator SPAN.result
    {
      font-family: Tahoma, Verdana, Arial, sans-serif;
      margin-right: 1ex;
      font-size: 90%;
      color: #333;
    }
    #TestList LI .indicator A
    {
      font-size: 85%;
      color: #0066CC;
    }

    #Content
    {
      height: 100%;
      overflow: auto;
      overflow-x: hidden;
      overflow-y: scroll;
    }

    #TestResult
    {
      font-family: Georgia;
      font-size: small;
      _font-size: x-small;
    }


    IFRAME
    {
      width: 5px;
      height: 5px;
    }

    .progress
    {
      border: 1px solid #E0E0E0;
      padding: 2px;
      margin: 2px 4px 0;
      text-align: left;
    }
    .progress .bar
    {
      background: blue;
      width: 0;
      height: 5px;
      font-size: 0;
    }
   
  </style>
</head>

<body>
  <script type="text/javascript" src="../basis.js"></script>
  <script type="text/javascript">
    Basis.Event.onLoad(function(){
      var DOM = Basis.DOM;
      var Event = Basis.Event;
      var CSS = Basis.CSS;

      var testCases = [
                       { 
                         filename: 'basis-buildin_ext_and_fix.html',
                         name: 'Buildin Classes/Objects extensions & fix'
                       }, 
                       { 
                         filename: 'basis-date.html',
                         name: 'Date'
                       }, 
                       { 
                         filename: 'basis-dom.html',
                         name: 'DOM'
                       },
                       { 
                         filename: 'basis-dom_wrapers.html',
                         name: 'DOM.Wrapers'
                       }, 
                       { 
                         filename: 'basis-crypt.html',
                         name: 'Crypt'
                       }, 
                       { 
                         filename: 'basis-browser.html',
                         name: 'Browser'
                       }, 
                       { 
                         filename: 'basis-data.html',
                         name: 'Data'
                       }
                      ];
      var testers   = [];
      var currentTest;

//      Basis.addHandler('TestList', 'resize', function(){ alert('!a') });
//      DOM.insert('Content', Basis.Debug.inspect(DOM.get('TestList').style));
      DOM.insert('TestList', 
        DOM.createElement('UL', testCases.map(function(item, index){
          return DOM.createElement('LI',
                   item.indicator = DOM.createElement('DIV.indicator'/*,
                     DOM.createElement('SPAN.result', '(999/999)'),
                     DOM.createElement('A[href=#]', 'details') /**/
                   ),
                   DOM.createElement('LABEL',
                     DOM.createElement('.checker',
                       item.checkbox = DOM.createElement('INPUT[type="checkbox"]' + (false ? '[checked]' : ''))
                     ),
                     DOM.createElement('.title[title=' + item.name.quote('"') + ']', item.name)
                   )
                 );
        }))
      );

      regTestCase = function(test){
        var testcase = {
          tester: test.tester,
          name:   test.name,
          test:   test,
          progress: DOM.createElement('.progress', DOM.createElement('.bar'))
        };

        test.tester.state.addLink(testcase.progress, function(value){ DOM.css(this, { display: value == 'run' ? '' : 'none' }) }, testcase.progress);

        test.addHandler({
          progress: function(diff, progress){
            DOM.css(this.progress.firstChild, { width: CSS.percent(progress * 100) });
          },
          reset: function(){
          },
          over: function(){
            DOM.insert(DOM.clear(this.indicator), [
              DOM.createElement('SPAN.result', '({1}/{0})'.format(this.test.testCount, this.test.successCount)),
              DOM.createElement({
                description: 'A[href=#]',
                click: new Event.Handler(function(e){ 
                  DOM.get('TestResult').innerHTML = this.test.toHTML();
                  //DOM.insert(DOM.clear('TestResult'), DOM.createElement('.res', this.test.toDOM(DOM)));
                  Event.kill(e);
                }, this)
              }, 'details')
            ]);
            nextTest();
          }
        }, testcase)

        currentTest.testers.push(testcase);
      }

      currentTestCase = 0;
      nextTest = function(){
        if (currentTest)
        {
          var node = DOM.get('TestList').firstChild.childNodes[currentTestCase - 1];
          node.style.color = 'green';
          if (currentTest.testers && currentTest.testers.length)
            currentTest.testers.forEach(function(item){
              item.indicator = currentTest.indicator;
              DOM.insert(item.indicator, item.progress);
              item.tester.run(item.testcase);
              //DOM.insert('test_result', DOM.createElement('.res', item.result.toDOM(DOM)));
            });
        }

        currentTest = testCases[currentTestCase++];
        if (!currentTest)
          return;

        if (!currentTest.checkbox.checked)
        {
          currentTest = null;
          return nextTest();
        }

        if (currentTest.testers)
        {
        }
        else
        {
          currentTest.testers = [];
          DOM.insert('test_place', DOM.createElement('IFRAME[src=' + (currentTest.filename + '?' + Math.random()).quote('"') + ']'));
        }
      }
      nextTest();
//      alert(Basis.keys(document).sort());
    });
  </script>
  <div id="Interface">
    <div id="TestList"></div>
    <div id="Content">
      <button onclick="currentTestCase=0;nextTest();">Start</button>
      <button onclick="currentTestCase=0;nextTest();">Stop</button>
      <div id="test_place"></div>
      <div id="test_result"></div>
      <div id="TestResult"></div>
    </div>
  </div>
</body>
</html>